<% layout('/layouts/default.html', {title: '定修计划维护管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${text('定修计划维护管理')}
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
				<a href="#" class="btn btn-default" id="btnRefreshTree" title="${text('刷新')}"><i class="fa fa-refresh"></i> ${text('刷新')}</a>
				<a href="#" class="btn btn-default" id="btnExpandTreeNode" title="${text('展开一级')}"><i class="fa fa-angle-double-down"></i> ${text('展开')}</a>
				<a href="#" class="btn btn-default" id="btnCollapseTreeNode" title="${text('折叠全部')}"><i class="fa fa-angle-double-up"></i> ${text('折叠')}</a>
				<% if(hasPermi('test:regularMaintainPlan:edit')){ %>
					<a href="${ctx}/test/regularMaintainPlan/form" class="btn btn-default btnTool" title="${text('新增定修计划维护')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
				<% } %>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${regularMaintainPlan}" action="${ctx}/test/regularMaintainPlan/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">${text('计划名称')}：</label>
					<div class="control-inline">
						<#form:input path="regularTreeName" maxlength="200" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('设备编号')}：</label>
					<div class="control-inline">
						<#form:input path="equipCode" maxlength="64" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('备品备件编号')}：</label>
					<div class="control-inline">
						<#form:input path="componentCode" maxlength="64" class="form-control width-120"/>
					</div>
				</div>
				<!--<div class="form-group">-->
					<!--<label class="control-label">${text('定修部位')}：</label>-->
					<!--<div class="control-inline">-->
						<!--<#form:input path="regularMaintainPart" maxlength="255" class="form-control width-120"/>-->
					<!--</div>-->
				<!--</div>-->
				<!--<div class="form-group">-->
					<!--<label class="control-label">${text('定修内容')}：</label>-->
					<!--<div class="control-inline">-->
						<!--<#form:input path="regularMaintainContent" maxlength="255" class="form-control width-120"/>-->
					<!--</div>-->
				<!--</div>-->
				<!--<div class="form-group">-->
					<!--<label class="control-label">${text('定修目标')}：</label>-->
					<!--<div class="control-inline">-->
						<!--<#form:input path="regularMaintainGoal" maxlength="255" class="form-control width-120"/>-->
					<!--</div>-->
				<!--</div>-->
				<div class="form-group">
					<label class="control-label">${text('定修周期')}：</label>
					<div class="control-inline width-120">
						<#form:select path="regularMaintainCycle" dictType="regular_maintain_cycle" blankOption="true"  maxlength="1" class="form-control"/>
					</div>
				</div>
				<!--<div class="form-group">-->
					<!--<label class="control-label">${text('定修员编号')}：</label>-->
					<!--<div class="control-inline">-->
						<!--<#form:input path="maintainerCode" maxlength="64" class="form-control width-120"/>-->
					<!--</div>-->
				<!--</div>-->
				<!--<div class="form-group">-->
					<!--<label class="control-label">${text('状态')}：</label>-->
					<!--<div class="control-inline width-120">-->
						<!--<#form:select path="status" dictType="sys_search_status" blankOption="true" class="form-control"/>-->
					<!--</div>-->
				<!--</div>-->
				<!--<div class="form-group">-->
					<!--<label class="control-label">${text('备注信息')}：</label>-->
					<!--<div class="control-inline">-->
						<!--<#form:input path="remarks" maxlength="500" class="form-control width-120"/>-->
					<!--</div>-->
				<!--</div>-->
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text('计划名称')}', name:'regularTreeName', index:'a.regular_tree_name', width:250, align:"left", frozen:true, formatter: function(val, obj, row, act){
			 if(row.regularMaintainCycle == '0'){
            	row.regularMaintainCycle ="月";
            }else if(row.regularMaintainCycle == '1'){
            	row.regularMaintainCycle ="季度";
            }else{
            	row.regularMaintainCycle ="年";
            }
			return '( '+row.regularPlanCode+' ) '+'<a href="${ctx}/test/regularMaintainPlan/form?regularPlanCode='+row.regularPlanCode+'" class="btnList" data-title="${text('编辑定修计划维护')}">'+(val||row.id)+'</a>';
		}},
		//{header:'${text('本级排序号')}', name:'treeSort', index:'a.tree_sort', width:150, align:"center"},
		//{header:'${text('定修节点名称')}', name:'regularTreeName', index:'a.regular_tree_name', width:150, align:"left"},
		{header:'${text('设备编号')}', name:'equipCode', index:'a.equip_code', width:150, align:"left"},
		<!--<备品备件编号不应该出现在定修计划列表中，在定修结果中显示就可以了>-->
		//{header:'${text('备品备件编号')}', name:'componentCode', index:'a.component_code', width:150, align:"left"},
		{header:'${text('定修部位')}', name:'regularMaintainPart', index:'a.regular_maintain_part', width:150, align:"left"},
		{header:'${text('定修内容')}', name:'regularMaintainContent', index:'a.regular_maintain_content', width:150, align:"left"},
		{header:'${text('定修目标')}', name:'regularMaintainGoal', index:'a.regular_maintain_goal', width:150, align:"left"},
		{header:'${text('定修周期')}', name:'regularMaintainCycle', index:'a.regular_maintain_cycle', width:150, align:"left"},
		//{header:'${text('定修员编号')}', name:'maintainerCode', index:'a.maintainer_code', width:150, align:"left"},
		<!--{header:'${text('状态')}', name:'status', index:'a.status', width:150, align:"center", formatter: function(val, obj, row, act){-->
			<!--return js.getDictLabel(${@DictUtils.getDictListJson('sys_search_status')}, val, '${text('未知')}', true);-->
		<!--}},-->
		//{header:'${text('创建时间')}', name:'createDate', index:'a.create_date', width:150, align:"center"},
		{header:'${text('备注信息')}', name:'remarks', index:'a.remarks', width:150, align:"left"},
		{header:'${text('操作')}', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){
			var actions = [];
			<% if(hasPermi('test:regularMaintainPlan:edit')){ %>
				actions.push('<a href="${ctx}/test/regularMaintainPlan/form?regularPlanCode='+row.regularPlanCode+'" class="btnList" title="${text('编辑定修计划维护')}"><i class="fa fa-pencil"></i></a>&nbsp;');
				<!--if (row.status == Global.STATUS_NORMAL){-->
					<!--actions.push('<a href="${ctx}/test/regularMaintainPlan/disable?regularPlanCode='+row.regularPlanCode+'" class="btnList" title="${text('停用定修计划维护')}" data-confirm="${text('确认要停用该定修计划维护吗？')}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');-->
				<!--}-->
				<!--if (row.status == Global.STATUS_DISABLE){-->
					<!--actions.push('<a href="${ctx}/test/regularMaintainPlan/enable?regularPlanCode='+row.regularPlanCode+'" class="btnList" title="${text('启用定修计划维护')}" data-confirm="${text('确认要启用该定修计划维护吗？')}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');-->
				<!--}-->
				actions.push('<a href="${ctx}/test/regularMaintainPlan/delete?regularPlanCode='+row.regularPlanCode+'" class="btnList" title="${text('删除定修计划维护')}" data-confirm="${text('确认要删除该定修计划维护及所有子定修计划维护吗？')}" data-deltreenode="'+row.id+'"><i class="fa fa-trash-o"></i></a>&nbsp;');
				actions.push('<a href="${ctx}/test/regularMaintainPlan/form?parentCode='+row.id+'" class="btnList" title="${text('新增下级定修计划维护')}"><i class="fa fa-plus-square"></i></a>&nbsp;');
			<% } %>
			<!--<定修计划安排权限归设备管理所有>-->
			 <% if(hasPermi('test:regularMaintainPlan:assign')){ %>
                actions.push('<a href="${ctx}/test/regularMaintainSchedule/form?regularPlanCode='+row.regularPlanCode+'" class="btnList" title="${text('定修计划安排')}"><i class="fa fa-arrow-circle-right"></i></a>&nbsp;');
             <% } %>
			<!--<定修结果录入权限与定修计划编辑权限是相互独立的，定修结果录入权归维护员，计划编辑权归设备管理员>-->
			 <% if(hasPermi('test:regularMaintainResult:edit')){ %>
                actions.push('<a href="${ctx}/test/regularMaintainResult/form?regularPlanCode='+row.regularPlanCode+'" class="btnList" title="${text('定修结果录入')}"><i class="fa fa-magic"></i></a>&nbsp;');
             <% } %>
			return actions.join('');
		}}
	],
	treeGrid: true,			// 启用树结构表格
	defaultExpandLevel: 0,	// 默认展开的层次
	expandNodeClearPostData: 'regularTreeName,equipCode,componentCode,regularMaintainPart,regularMaintainContent,regularMaintainGoal,regularMaintainCycle,maintainerCode,status,remarks,', // 展开节点清理请求参数数据（一般设置查询条件的字段属性，否则在查询后，不能展开子节点数据）	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>